package com.tengju.data.domain.model.wx;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author: 李大仙
 * @date: 2021/11/7 5:09 下午
 */
@Getter
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
@AllArgsConstructor
public enum WxRequestRecordStatus {
    INIT(1, "初始化"),
    SUCCESS(2, "成功"),
    FAIL(3, "失败"),
    ;

    private Integer code;
    private String desc;

    public static WxRequestRecordStatus form(Integer code) {
        if (code == null) {
            return null;
        }
        for (WxRequestRecordStatus status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        return null;
    }

}
